﻿using System.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Marbles.CMS.Core
{
    public class AdministratorPageBase : Marbles.Core.Web.Templates.Page
    {

        public bool IsAdministrator
        {
            get
            {
                return Roles.IsUserInRole("Administrator");
            }
        }

        protected override void OnPreInit(EventArgs e)
        {
            Page.Theme = "Administrator";
            base.OnPreInit(e);
        }

        protected override void OnLoad(EventArgs e)
        {
            if (!IsAdministrator) { Response.Redirect("/", true); return; }
            base.OnLoad(e);
        }
    }
}
